#ifndef SNAKE5_H
#define SNAKE5_H
#include "dialog_1.h"
#include <QMainWindow>
#include <qstring.h>

namespace Ui {
class Snake5;
}

class Snake5 : public QMainWindow
{
    Q_OBJECT

public:
    explicit Snake5(QWidget *parent = 0);
    ~Snake5();
    void paintEvent(QPaintEvent *event);
                void initSnake();
                void initBoom();
                QRect CreateRect();
                void IsEat();
                void IsHit();
                void IsBoom();
                void IsLose();
                void IsClose();
                void keyPressEvent(QKeyEvent *event);
            private slots:
                void Snake_update();

private:
    Ui::Snake5 *ui;
    Dialog_1 *D=new Dialog_1;
    QVector<QRect> vSnakeRect;
                QRect vSnakeHead;
                QTimer *timer;//定时器
                int Direction;//蛇的移动方向
                bool Run;//是否开始
                bool Over;//是否结束
                bool Change;//炸弹是否变化
                bool Shorten;//是否缩短
                QRect food;
                QVector<QRect> boom;//炸弹
                int speed;//移动速度
                int nScore;
                QString scorelabel;

};

#endif // SNAKE5_H
